<template>
  <!-- 2容器 -->
  <div class="charts" ref="charts"></div>
</template>

<script>
import echarts from 'echarts' //1引入
export default {
  name: '',
  mounted() {
    //   3初始化实例
    let lineCharts = echarts.init(this.$refs.charts)
    //配置
    lineCharts.setOption({
      xAxis: {
        show: false,
        min: 0,
        max: 100,
      },
      yAxis: {
        show: false,
        type: 'category',
      },
      series: {
        type: 'bar',
        data: [78],
        barWidth: 10,
        color: 'yellowgreen',
        showBackground: true,
        backgroundstyle: {
          color: '#eeee',
        },
        label: {
          show: true,
          formatter: '|',
          position: 'right',
        },
      },
      grid: {
        left: 0,
        top: 0,
        bottom: 0,
        right: 0,
      },
    })
  },
}
</script>

<style scoped>
.charts {
  width: 100%;
  height: 100%;
}
</style>
